<?php
my_component_load('testing' , false);
my_component_load('paging' , false);  
my_component_load('xl_builder' , false);   
my_component_load('pr_potongan_limit' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$kspes = isset( $_GET['kspes'] ) ? $_GET['kspes']:  0;
$knik = isset( $_GET['knik'] ) ? $_GET['knik']:  "";
$kbulan = isset( $_GET['kbulan'] ) ? $_GET['kbulan']:  0;
$ktahun = isset( $_GET['ktahun'] ) ? $_GET['ktahun']:  "";
$kstatus = isset( $_GET['kstatus'] ) ? $_GET['kstatus']:  0;
$modulname = "Penggajian _BN_ Potongan Limit Waktu";
 
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){ 
/*	
		case "edit_detail_page":
			submit_potongan_limit_detail($id , $sid) ;
			generate_my_web('Updated', $pagename ,"plain.php");
			exit;
		break; 
*/		
		case "edit_page":
			submit_potongan_limit($id) ;
			generate_my_web('Updated', $pagename ,"plain.php");
			exit;
		break;
	}

else: 	
	if($task == "detail_excel"){ 
		
		$dts = my_get_data_by_id('pr_potongan_limit','potongan_limit_id',$id);
		$karyawan = loaddata_karyawan($dts['karyawan_id']);
		header("Content-Type: application/xls");
		header("Content-Disposition: attachment;filename=pot_limit_waktu_". $karyawan['nik'].'_'.rand().".xls");
		echo potongan_limit_detail_excel($id);
		exit;
	}elseif($task == "detail"){ 
		$pagename = $modulname." _BN_ Detail";
		load_facebox_script();
		$content = potongan_limit_detail($id,$kspes,$knik,$kbulan,$ktahun,$kstatus);
/*		
	}elseif($task == "edit_detail"){ 
		$pagename = ($sid > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=pr_potongan_limit&task=edit_detail_page&id='.$id.'&sid='.$sid , $pagename , 360	);
	}elseif($task == "edit_detail_page"){
		$content = form_potongan_limit_detail($sid , $id);
		generate_my_web($content, '' ,"plain.php");
		exit;
*/		
	}elseif($task == "plaincetak"){
		@ob_end_clean(); 
		echo'<pre>';
		echo print_plain($kspes,$knik,$kbulan,$ktahun,$kstatus);
		exit;
	}elseif($task == "excel"){
		header("Content-Type: application/xls");
		header("Content-Disposition: attachment;filename=potongan_limit_waktu.xls");
		echo excel_report_pot_limit($kspes,$knik,$kbulan,$ktahun,$kstatus);
		exit;
	}elseif($task == "edit"){ 
		$pagename = ($id > 0 ) ? "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=pr_potongan_limit&task=edit_page&id='.$id, $pagename , 360	);
	}elseif($task == "edit_page"){
		$content = form_potongan_limit($id);
		generate_my_web($content, '' ,"plain.php");
		exit;
	}elseif($task == 'delete'){ 
		delete_potongan_limit($id);
		my_direct('index.php?com='.$_GET['com']);		
	}else{ 
		$pagename = $modulname;
		load_facebox_script();
		$content =  list_potongan($kspes,$knik,$kbulan,$ktahun,$kstatus); 
	}
endif;  
generate_my_web($content, $pagename );
?>